init:
	make common-proto
	make proto-all
	make swagger
	make doc
	make server name=wechat
	make server name=user
	make server name=music
	make server name=attachment
	make api
docker:
	make common-proto
	make proto-all
	make swagger
	make doc
	make docker-server name=wechat
	make docker-server name=user
	make docker-server name=music
	make docker-server name=attachment
	make docker-api
common-proto:
	./build-common.sh
proto-all:
	make build -f ./services/wechat/Makefile
	make build -f ./services/user/Makefile
	make build -f ./services/music/Makefile
	make build -f ./services/attachment/Makefile
proto:
	make build -f ./services/$(name)/Makefile
swagger:
	rm -rf ./cmd/swagger && go build -v -o ./cmd/swagger ./swagger.go
server:
	rm -rf ./cmd/$(name)/main && go build -v -o ./cmd/$(name)/main ./services/$(name)/cmd/main.go
api:
	rm -rf ./cmd/main && go build -v -o ./cmd/main ./main.go
docker-server:
	rm -rf ./cmd/docker/$(name)/main && GOOS=linux GOARCH=amd64 go build -v -o ./cmd/docker/$(name)/main ./services/$(name)/cmd/main.go
docker-api:
	rm -rf ./cmd/docker/main && GOOS=linux GOARCH=amd64 go build -v -o ./cmd/docker/main ./main.go
run:
	./cmd/main
run-srv:
	./cmd/$(name)/main
doc:
	./cmd/swagger
re-run-srv:
	make server name=$(name) && make run-srv name=$(name)
re-run-app:
	make api && make run